using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;


namespace Framework.Graphics
{
    public sealed class GraphicsManager : FrameworkModule
    {
        private ScriptableRenderer m_Renderer;

        public override void Init()
        {
            UniversalRenderPipelineAsset asset = GraphicsSettings.renderPipelineAsset as UniversalRenderPipelineAsset;
            m_Renderer = asset.GetRenderer(0);
        }

        public void SetRenderFeatureActive(ERenderFeature feature, bool isActive)
        {
            ScriptableRendererFeature renderFeature = m_Renderer.GetRenderFeature((int)feature);
            if (renderFeature != null)
            {
                renderFeature.SetActive(isActive);
            }
            else
            {
                Log.Error("[Graphics] Don't have render feature {0}.", feature);
            }
        }
    }
}